package com.svndiffdoc;

import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.tmatesoft.svn.core.wc.ISVNAnnotateHandler;

public class AnnotatedFile implements ISVNAnnotateHandler {
    private int lineNumber;
    private final List<AnnotatedFileLine> lines;

    public AnnotatedFile() {
        lineNumber = 0;
        lines = new ArrayList<AnnotatedFileLine>();
    }

    @Override
    public void handleLine(Date date, long revision, String author, String line) {
        lineNumber++;
        handleLine(date, revision, author, line, null, -1, null, null, lineNumber);
    }

    @Override
    public void handleLine(Date date, long revision, String author, String line, Date mergedDate, long mergedRevision, String mergedAuthor, String mergedPath, int lineNumber) {
        lines.add(new AnnotatedFileLine(date, revision, author, lineNumber, line));
    }

    @Override
    public boolean handleRevision(Date date, long revision, String author, File contents) {
        return false;
    }

    @Override
    public void handleEOF() {
    }

    public List<AnnotatedFileLine> getLines() {
        return lines;
    }

}